/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    ap-northeast-2-pop = 'arms.aliyuncs.com',
    cn-beijing-finance-1 = 'arms.aliyuncs.com',
    cn-beijing-finance-pop = 'arms.aliyuncs.com',
    cn-beijing-gov-1 = 'arms.aliyuncs.com',
    cn-beijing-nu16-b01 = 'arms.aliyuncs.com',
    cn-edge-1 = 'arms.aliyuncs.com',
    cn-fujian = 'arms.aliyuncs.com',
    cn-haidian-cm12-c01 = 'arms.aliyuncs.com',
    cn-hangzhou-bj-b01 = 'arms.aliyuncs.com',
    cn-hangzhou-internal-prod-1 = 'arms.aliyuncs.com',
    cn-hangzhou-internal-test-1 = 'arms.aliyuncs.com',
    cn-hangzhou-internal-test-2 = 'arms.aliyuncs.com',
    cn-hangzhou-internal-test-3 = 'arms.aliyuncs.com',
    cn-hangzhou-test-306 = 'arms.aliyuncs.com',
    cn-hongkong-finance-pop = 'arms.aliyuncs.com',
    cn-huhehaote-nebula-1 = 'arms.aliyuncs.com',
    cn-qingdao-nebula = 'arms.aliyuncs.com',
    cn-shanghai-et15-b01 = 'arms.aliyuncs.com',
    cn-shanghai-et2-b01 = 'arms.aliyuncs.com',
    cn-shanghai-inner = 'arms.aliyuncs.com',
    cn-shanghai-internal-test-1 = 'arms.aliyuncs.com',
    cn-shenzhen-inner = 'arms.aliyuncs.com',
    cn-shenzhen-st4-d01 = 'arms.aliyuncs.com',
    cn-shenzhen-su18-b01 = 'arms.aliyuncs.com',
    cn-wuhan = 'arms.aliyuncs.com',
    cn-yushanfang = 'arms.aliyuncs.com',
    cn-zhangbei = 'arms.aliyuncs.com',
    cn-zhangbei-na61-b01 = 'arms.aliyuncs.com',
    cn-zhangjiakou-na62-a01 = 'arms.aliyuncs.com',
    cn-zhengzhou-nebula-1 = 'arms.aliyuncs.com',
    eu-west-1-oxs = 'arms.aliyuncs.com',
    me-east-1 = 'arms.aliyuncs.com',
    rus-west-1-pop = 'arms.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('arms', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddGrafanaRequest {
  clusterId?: string(name='ClusterId'),
  integration?: string(name='Integration'),
  regionId?: string(name='RegionId'),
}

model AddGrafanaResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model AddGrafanaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddGrafanaResponseBody(name='body'),
}

async function addGrafanaWithOptions(request: AddGrafanaRequest, runtime: Util.RuntimeOptions): AddGrafanaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.integration)) {
    query['Integration'] = request.integration;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddGrafana',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addGrafana(request: AddGrafanaRequest): AddGrafanaResponse {
  var runtime = new Util.RuntimeOptions{};
  return addGrafanaWithOptions(request, runtime);
}

model AddIntegrationRequest {
  clusterId?: string(name='ClusterId'),
  integration?: string(name='Integration'),
  regionId?: string(name='RegionId'),
}

model AddIntegrationResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model AddIntegrationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddIntegrationResponseBody(name='body'),
}

async function addIntegrationWithOptions(request: AddIntegrationRequest, runtime: Util.RuntimeOptions): AddIntegrationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.integration)) {
    query['Integration'] = request.integration;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddIntegration',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addIntegration(request: AddIntegrationRequest): AddIntegrationResponse {
  var runtime = new Util.RuntimeOptions{};
  return addIntegrationWithOptions(request, runtime);
}

model ApplyScenarioRequest {
  appId?: string(name='AppId'),
  config?: map[string]any(name='Config'),
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  scenario?: string(name='Scenario'),
  sign?: string(name='Sign'),
  snDump?: boolean(name='SnDump'),
  snForce?: boolean(name='SnForce'),
  snStat?: boolean(name='SnStat'),
  snTransfer?: boolean(name='SnTransfer'),
  updateOption?: boolean(name='UpdateOption'),
}

model ApplyScenarioShrinkRequest {
  appId?: string(name='AppId'),
  configShrink?: string(name='Config'),
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  scenario?: string(name='Scenario'),
  sign?: string(name='Sign'),
  snDump?: boolean(name='SnDump'),
  snForce?: boolean(name='SnForce'),
  snStat?: boolean(name='SnStat'),
  snTransfer?: boolean(name='SnTransfer'),
  updateOption?: boolean(name='UpdateOption'),
}

model ApplyScenarioResponseBody = {
  requestId?: string(name='RequestId'),
  result?: string(name='Result'),
}

model ApplyScenarioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ApplyScenarioResponseBody(name='body'),
}

async function applyScenarioWithOptions(tmpReq: ApplyScenarioRequest, runtime: Util.RuntimeOptions): ApplyScenarioResponse {
  Util.validateModel(tmpReq);
  var request = new ApplyScenarioShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.config)) {
    request.configShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.config, 'Config', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.configShrink)) {
    query['Config'] = request.configShrink;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.scenario)) {
    query['Scenario'] = request.scenario;
  }
  if (!Util.isUnset(request.sign)) {
    query['Sign'] = request.sign;
  }
  if (!Util.isUnset(request.snDump)) {
    query['SnDump'] = request.snDump;
  }
  if (!Util.isUnset(request.snForce)) {
    query['SnForce'] = request.snForce;
  }
  if (!Util.isUnset(request.snStat)) {
    query['SnStat'] = request.snStat;
  }
  if (!Util.isUnset(request.snTransfer)) {
    query['SnTransfer'] = request.snTransfer;
  }
  if (!Util.isUnset(request.updateOption)) {
    query['UpdateOption'] = request.updateOption;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ApplyScenario',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function applyScenario(request: ApplyScenarioRequest): ApplyScenarioResponse {
  var runtime = new Util.RuntimeOptions{};
  return applyScenarioWithOptions(request, runtime);
}

model CheckDataConsistencyRequest {
  appType?: string(name='AppType'),
  currentTimestamp?: long(name='CurrentTimestamp'),
  pid?: string(name='Pid'),
  proxyUserId?: string(name='ProxyUserId'),
  regionId?: string(name='RegionId'),
}

model CheckDataConsistencyResponseBody = {
  isDataConsistency?: boolean(name='IsDataConsistency'),
  requestId?: string(name='RequestId'),
}

model CheckDataConsistencyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckDataConsistencyResponseBody(name='body'),
}

async function checkDataConsistencyWithOptions(request: CheckDataConsistencyRequest, runtime: Util.RuntimeOptions): CheckDataConsistencyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appType)) {
    query['AppType'] = request.appType;
  }
  if (!Util.isUnset(request.currentTimestamp)) {
    query['CurrentTimestamp'] = request.currentTimestamp;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckDataConsistency',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkDataConsistency(request: CheckDataConsistencyRequest): CheckDataConsistencyResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkDataConsistencyWithOptions(request, runtime);
}

model CheckServiceLinkedRoleForDeletingRequest {
  deletionTaskId?: string(name='DeletionTaskId'),
  regionId?: string(name='RegionId'),
  roleArn?: string(name='RoleArn'),
  SPIRegionId?: string(name='SPIRegionId'),
  serviceName?: string(name='ServiceName'),
}

model CheckServiceLinkedRoleForDeletingResponseBody = {
  deletable?: boolean(name='Deletable'),
  requestId?: string(name='RequestId'),
  roleUsages?: [ 
    {
      region?: string(name='Region'),
      resources?: [ string ](name='Resources'),
    }
  ](name='RoleUsages'),
}

model CheckServiceLinkedRoleForDeletingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckServiceLinkedRoleForDeletingResponseBody(name='body'),
}

async function checkServiceLinkedRoleForDeletingWithOptions(request: CheckServiceLinkedRoleForDeletingRequest, runtime: Util.RuntimeOptions): CheckServiceLinkedRoleForDeletingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.deletionTaskId)) {
    query['DeletionTaskId'] = request.deletionTaskId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.roleArn)) {
    query['RoleArn'] = request.roleArn;
  }
  if (!Util.isUnset(request.SPIRegionId)) {
    query['SPIRegionId'] = request.SPIRegionId;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckServiceLinkedRoleForDeleting',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkServiceLinkedRoleForDeleting(request: CheckServiceLinkedRoleForDeletingRequest): CheckServiceLinkedRoleForDeletingResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkServiceLinkedRoleForDeletingWithOptions(request, runtime);
}

model CheckServiceStatusRequest {
  regionId?: string(name='RegionId'),
  svcCode?: string(name='SvcCode'),
}

model CheckServiceStatusResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model CheckServiceStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckServiceStatusResponseBody(name='body'),
}

async function checkServiceStatusWithOptions(request: CheckServiceStatusRequest, runtime: Util.RuntimeOptions): CheckServiceStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.svcCode)) {
    query['SvcCode'] = request.svcCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckServiceStatus',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkServiceStatus(request: CheckServiceStatusRequest): CheckServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkServiceStatusWithOptions(request, runtime);
}

model ConfigAppRequest {
  appIds?: string(name='AppIds'),
  enable?: string(name='Enable'),
  regionId?: string(name='RegionId'),
}

model ConfigAppResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model ConfigAppResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ConfigAppResponseBody(name='body'),
}

async function configAppWithOptions(request: ConfigAppRequest, runtime: Util.RuntimeOptions): ConfigAppResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appIds)) {
    query['AppIds'] = request.appIds;
  }
  if (!Util.isUnset(request.enable)) {
    query['Enable'] = request.enable;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConfigApp',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function configApp(request: ConfigAppRequest): ConfigAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return configAppWithOptions(request, runtime);
}

model CreateAlertContactRequest {
  contactName?: string(name='ContactName'),
  dingRobotWebhookUrl?: string(name='DingRobotWebhookUrl'),
  email?: string(name='Email'),
  phoneNum?: string(name='PhoneNum'),
  regionId?: string(name='RegionId'),
  systemNoc?: boolean(name='SystemNoc'),
}

model CreateAlertContactResponseBody = {
  contactId?: string(name='ContactId'),
  requestId?: string(name='RequestId'),
}

model CreateAlertContactResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAlertContactResponseBody(name='body'),
}

async function createAlertContactWithOptions(request: CreateAlertContactRequest, runtime: Util.RuntimeOptions): CreateAlertContactResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.dingRobotWebhookUrl)) {
    query['DingRobotWebhookUrl'] = request.dingRobotWebhookUrl;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.phoneNum)) {
    query['PhoneNum'] = request.phoneNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.systemNoc)) {
    query['SystemNoc'] = request.systemNoc;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAlertContact',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAlertContact(request: CreateAlertContactRequest): CreateAlertContactResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAlertContactWithOptions(request, runtime);
}

model CreateAlertContactGroupRequest {
  contactGroupName?: string(name='ContactGroupName'),
  contactIds?: string(name='ContactIds'),
  regionId?: string(name='RegionId'),
}

model CreateAlertContactGroupResponseBody = {
  contactGroupId?: string(name='ContactGroupId'),
  requestId?: string(name='RequestId'),
}

model CreateAlertContactGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAlertContactGroupResponseBody(name='body'),
}

async function createAlertContactGroupWithOptions(request: CreateAlertContactGroupRequest, runtime: Util.RuntimeOptions): CreateAlertContactGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactGroupName)) {
    query['ContactGroupName'] = request.contactGroupName;
  }
  if (!Util.isUnset(request.contactIds)) {
    query['ContactIds'] = request.contactIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAlertContactGroup',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAlertContactGroup(request: CreateAlertContactGroupRequest): CreateAlertContactGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAlertContactGroupWithOptions(request, runtime);
}

model CreateAlertTemplateRequest {
  annotations?: string(name='Annotations'),
  labels?: string(name='Labels'),
  matchExpressions?: string(name='MatchExpressions'),
  message?: string(name='Message'),
  name?: string(name='Name'),
  parentId?: string(name='ParentId'),
  regionId?: string(name='RegionId'),
  rule?: string(name='Rule'),
  templateProvider?: string(name='TemplateProvider'),
  type?: string(name='Type'),
}

model CreateAlertTemplateResponseBody = {
  alertTemplate?: {
    alertProvider?: string(name='AlertProvider'),
    annotations?: map[string]any(name='Annotations'),
    id?: int32(name='Id'),
    labelMatchExpressionGrid?: {
      labelMatchExpressionGroups?: [ 
        {
          labelMatchExpressions?: [ 
            {
              key?: string(name='Key'),
              operator?: string(name='Operator'),
              value?: string(name='Value'),
            }
          ](name='LabelMatchExpressions'),
        }
      ](name='LabelMatchExpressionGroups'),
    }(name='LabelMatchExpressionGrid'),
    labels?: map[string]any(name='Labels'),
    message?: string(name='Message'),
    name?: string(name='Name'),
    parentId?: int32(name='ParentId'),
    public?: boolean(name='Public'),
    rule?: string(name='Rule'),
    status?: boolean(name='Status'),
    templateProvider?: string(name='TemplateProvider'),
    type?: string(name='Type'),
    userId?: string(name='UserId'),
  }(name='AlertTemplate'),
  requestId?: string(name='RequestId'),
}

model CreateAlertTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAlertTemplateResponseBody(name='body'),
}

async function createAlertTemplateWithOptions(request: CreateAlertTemplateRequest, runtime: Util.RuntimeOptions): CreateAlertTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.annotations)) {
    query['Annotations'] = request.annotations;
  }
  if (!Util.isUnset(request.labels)) {
    query['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.matchExpressions)) {
    query['MatchExpressions'] = request.matchExpressions;
  }
  if (!Util.isUnset(request.message)) {
    query['Message'] = request.message;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.parentId)) {
    query['ParentId'] = request.parentId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.rule)) {
    query['Rule'] = request.rule;
  }
  if (!Util.isUnset(request.templateProvider)) {
    query['TemplateProvider'] = request.templateProvider;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAlertTemplate',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAlertTemplate(request: CreateAlertTemplateRequest): CreateAlertTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAlertTemplateWithOptions(request, runtime);
}

model CreateDispatchRuleRequest {
  dispatchRule?: string(name='DispatchRule'),
  regionId?: string(name='RegionId'),
}

model CreateDispatchRuleResponseBody = {
  dispatchRuleId?: long(name='DispatchRuleId'),
  requestId?: string(name='RequestId'),
}

model CreateDispatchRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDispatchRuleResponseBody(name='body'),
}

async function createDispatchRuleWithOptions(request: CreateDispatchRuleRequest, runtime: Util.RuntimeOptions): CreateDispatchRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dispatchRule)) {
    query['DispatchRule'] = request.dispatchRule;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDispatchRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createDispatchRule(request: CreateDispatchRuleRequest): CreateDispatchRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDispatchRuleWithOptions(request, runtime);
}

model CreatePrometheusAlertRuleRequest {
  alertName?: string(name='AlertName'),
  annotations?: string(name='Annotations'),
  clusterId?: string(name='ClusterId'),
  dispatchRuleId?: long(name='DispatchRuleId'),
  duration?: string(name='Duration'),
  expression?: string(name='Expression'),
  labels?: string(name='Labels'),
  message?: string(name='Message'),
  notifyType?: string(name='NotifyType'),
  regionId?: string(name='RegionId'),
  type?: string(name='Type'),
}

model CreatePrometheusAlertRuleResponseBody = {
  prometheusAlertRule?: {
    alertId?: long(name='AlertId'),
    alertName?: string(name='AlertName'),
    annotations?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Annotations'),
    clusterId?: string(name='ClusterId'),
    dispatchRuleId?: long(name='DispatchRuleId'),
    duration?: string(name='Duration'),
    expression?: string(name='Expression'),
    labels?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Labels'),
    message?: string(name='Message'),
    notifyType?: string(name='NotifyType'),
    status?: int32(name='Status'),
    type?: string(name='Type'),
  }(name='PrometheusAlertRule'),
  requestId?: string(name='RequestId'),
}

model CreatePrometheusAlertRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatePrometheusAlertRuleResponseBody(name='body'),
}

async function createPrometheusAlertRuleWithOptions(request: CreatePrometheusAlertRuleRequest, runtime: Util.RuntimeOptions): CreatePrometheusAlertRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertName)) {
    query['AlertName'] = request.alertName;
  }
  if (!Util.isUnset(request.annotations)) {
    query['Annotations'] = request.annotations;
  }
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.dispatchRuleId)) {
    query['DispatchRuleId'] = request.dispatchRuleId;
  }
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.expression)) {
    query['Expression'] = request.expression;
  }
  if (!Util.isUnset(request.labels)) {
    query['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.message)) {
    query['Message'] = request.message;
  }
  if (!Util.isUnset(request.notifyType)) {
    query['NotifyType'] = request.notifyType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePrometheusAlertRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPrometheusAlertRule(request: CreatePrometheusAlertRuleRequest): CreatePrometheusAlertRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPrometheusAlertRuleWithOptions(request, runtime);
}

model CreateRetcodeAppRequest {
  regionId?: string(name='RegionId'),
  retcodeAppName?: string(name='RetcodeAppName'),
  retcodeAppType?: string(name='RetcodeAppType'),
}

model CreateRetcodeAppResponseBody = {
  requestId?: string(name='RequestId'),
  retcodeAppDataBean?: {
    appId?: long(name='AppId'),
    pid?: string(name='Pid'),
  }(name='RetcodeAppDataBean'),
}

model CreateRetcodeAppResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateRetcodeAppResponseBody(name='body'),
}

async function createRetcodeAppWithOptions(request: CreateRetcodeAppRequest, runtime: Util.RuntimeOptions): CreateRetcodeAppResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.retcodeAppName)) {
    query['RetcodeAppName'] = request.retcodeAppName;
  }
  if (!Util.isUnset(request.retcodeAppType)) {
    query['RetcodeAppType'] = request.retcodeAppType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateRetcodeApp',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createRetcodeApp(request: CreateRetcodeAppRequest): CreateRetcodeAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return createRetcodeAppWithOptions(request, runtime);
}

model CreateWehookRequest {
  body?: string(name='Body'),
  contactName?: string(name='ContactName'),
  httpHeaders?: string(name='HttpHeaders'),
  httpParams?: string(name='HttpParams'),
  method?: string(name='Method'),
  regionId?: string(name='RegionId'),
  url?: string(name='Url'),
}

model CreateWehookResponseBody = {
  contactId?: string(name='ContactId'),
  requestId?: string(name='RequestId'),
}

model CreateWehookResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateWehookResponseBody(name='body'),
}

async function createWehookWithOptions(request: CreateWehookRequest, runtime: Util.RuntimeOptions): CreateWehookResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.body)) {
    query['Body'] = request.body;
  }
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.httpHeaders)) {
    query['HttpHeaders'] = request.httpHeaders;
  }
  if (!Util.isUnset(request.httpParams)) {
    query['HttpParams'] = request.httpParams;
  }
  if (!Util.isUnset(request.method)) {
    query['Method'] = request.method;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.url)) {
    query['Url'] = request.url;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateWehook',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createWehook(request: CreateWehookRequest): CreateWehookResponse {
  var runtime = new Util.RuntimeOptions{};
  return createWehookWithOptions(request, runtime);
}

model DeleteAlertContactRequest {
  contactId?: long(name='ContactId'),
  regionId?: string(name='RegionId'),
}

model DeleteAlertContactResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model DeleteAlertContactResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteAlertContactResponseBody(name='body'),
}

async function deleteAlertContactWithOptions(request: DeleteAlertContactRequest, runtime: Util.RuntimeOptions): DeleteAlertContactResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlertContact',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteAlertContact(request: DeleteAlertContactRequest): DeleteAlertContactResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAlertContactWithOptions(request, runtime);
}

model DeleteAlertContactGroupRequest {
  contactGroupId?: long(name='ContactGroupId'),
  regionId?: string(name='RegionId'),
}

model DeleteAlertContactGroupResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model DeleteAlertContactGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteAlertContactGroupResponseBody(name='body'),
}

async function deleteAlertContactGroupWithOptions(request: DeleteAlertContactGroupRequest, runtime: Util.RuntimeOptions): DeleteAlertContactGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactGroupId)) {
    query['ContactGroupId'] = request.contactGroupId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlertContactGroup',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteAlertContactGroup(request: DeleteAlertContactGroupRequest): DeleteAlertContactGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAlertContactGroupWithOptions(request, runtime);
}

model DeleteAlertRulesRequest {
  alertIds?: string(name='AlertIds'),
  regionId?: string(name='RegionId'),
}

model DeleteAlertRulesResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model DeleteAlertRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteAlertRulesResponseBody(name='body'),
}

async function deleteAlertRulesWithOptions(request: DeleteAlertRulesRequest, runtime: Util.RuntimeOptions): DeleteAlertRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertIds)) {
    query['AlertIds'] = request.alertIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlertRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteAlertRules(request: DeleteAlertRulesRequest): DeleteAlertRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAlertRulesWithOptions(request, runtime);
}

model DeleteAlertTemplateRequest {
  id?: long(name='Id'),
  regionId?: string(name='RegionId'),
}

model DeleteAlertTemplateResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteAlertTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteAlertTemplateResponseBody(name='body'),
}

async function deleteAlertTemplateWithOptions(request: DeleteAlertTemplateRequest, runtime: Util.RuntimeOptions): DeleteAlertTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlertTemplate',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteAlertTemplate(request: DeleteAlertTemplateRequest): DeleteAlertTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAlertTemplateWithOptions(request, runtime);
}

model DeleteDispatchRuleRequest {
  id?: string(name='Id'),
  regionId?: string(name='RegionId'),
}

model DeleteDispatchRuleResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteDispatchRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteDispatchRuleResponseBody(name='body'),
}

async function deleteDispatchRuleWithOptions(request: DeleteDispatchRuleRequest, runtime: Util.RuntimeOptions): DeleteDispatchRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDispatchRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteDispatchRule(request: DeleteDispatchRuleRequest): DeleteDispatchRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDispatchRuleWithOptions(request, runtime);
}

model DeleteGrafanaResourceRequest {
  clusterId?: string(name='ClusterId'),
  clusterName?: string(name='ClusterName'),
  userId?: string(name='UserId'),
}

model DeleteGrafanaResourceResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteGrafanaResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteGrafanaResourceResponseBody(name='body'),
}

async function deleteGrafanaResourceWithOptions(request: DeleteGrafanaResourceRequest, runtime: Util.RuntimeOptions): DeleteGrafanaResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clusterId)) {
    body['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.clusterName)) {
    body['ClusterName'] = request.clusterName;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteGrafanaResource',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteGrafanaResource(request: DeleteGrafanaResourceRequest): DeleteGrafanaResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteGrafanaResourceWithOptions(request, runtime);
}

model DeletePrometheusAlertRuleRequest {
  alertId?: long(name='AlertId'),
}

model DeletePrometheusAlertRuleResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeletePrometheusAlertRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePrometheusAlertRuleResponseBody(name='body'),
}

async function deletePrometheusAlertRuleWithOptions(request: DeletePrometheusAlertRuleRequest, runtime: Util.RuntimeOptions): DeletePrometheusAlertRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeletePrometheusAlertRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePrometheusAlertRule(request: DeletePrometheusAlertRuleRequest): DeletePrometheusAlertRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deletePrometheusAlertRuleWithOptions(request, runtime);
}

model DeleteRetcodeAppRequest {
  appId?: string(name='AppId'),
  regionId?: string(name='RegionId'),
}

model DeleteRetcodeAppResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteRetcodeAppResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteRetcodeAppResponseBody(name='body'),
}

async function deleteRetcodeAppWithOptions(request: DeleteRetcodeAppRequest, runtime: Util.RuntimeOptions): DeleteRetcodeAppResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteRetcodeApp',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteRetcodeApp(request: DeleteRetcodeAppRequest): DeleteRetcodeAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteRetcodeAppWithOptions(request, runtime);
}

model DeleteScenarioRequest {
  regionId?: string(name='RegionId'),
  scenarioId?: long(name='ScenarioId'),
}

model DeleteScenarioResponseBody = {
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
}

model DeleteScenarioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteScenarioResponseBody(name='body'),
}

async function deleteScenarioWithOptions(request: DeleteScenarioRequest, runtime: Util.RuntimeOptions): DeleteScenarioResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.scenarioId)) {
    query['ScenarioId'] = request.scenarioId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteScenario',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteScenario(request: DeleteScenarioRequest): DeleteScenarioResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteScenarioWithOptions(request, runtime);
}

model DeleteTraceAppRequest {
  appId?: string(name='AppId'),
  pid?: string(name='Pid'),
  regionId?: string(name='RegionId'),
  type?: string(name='Type'),
}

model DeleteTraceAppResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteTraceAppResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTraceAppResponseBody(name='body'),
}

async function deleteTraceAppWithOptions(request: DeleteTraceAppRequest, runtime: Util.RuntimeOptions): DeleteTraceAppResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTraceApp',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTraceApp(request: DeleteTraceAppRequest): DeleteTraceAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTraceAppWithOptions(request, runtime);
}

model DescribeDispatchRuleRequest {
  id?: string(name='Id'),
  regionId?: string(name='RegionId'),
}

model DescribeDispatchRuleResponseBody = {
  dispatchRule?: {
    groupRules?: [ 
      {
        groupId?: long(name='GroupId'),
        groupInterval?: long(name='GroupInterval'),
        groupWaitTime?: long(name='GroupWaitTime'),
        groupingFields?: [ string ](name='GroupingFields'),
      }
    ](name='GroupRules'),
    labelMatchExpressionGrid?: {
      labelMatchExpressionGroups?: [ 
        {
          labelMatchExpressions?: [ 
            {
              key?: string(name='Key'),
              operator?: string(name='Operator'),
              value?: string(name='Value'),
            }
          ](name='LabelMatchExpressions'),
        }
      ](name='LabelMatchExpressionGroups'),
    }(name='LabelMatchExpressionGrid'),
    name?: string(name='Name'),
    notifyRules?: [ 
      {
        notifyChannels?: [ string ](name='NotifyChannels'),
        notifyObjects?: [ 
          {
            name?: string(name='Name'),
            notifyObjectId?: string(name='NotifyObjectId'),
            notifyType?: string(name='NotifyType'),
          }
        ](name='NotifyObjects'),
      }
    ](name='NotifyRules'),
    ruleId?: long(name='RuleId'),
    state?: string(name='State'),
  }(name='DispatchRule'),
  requestId?: string(name='RequestId'),
}

model DescribeDispatchRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDispatchRuleResponseBody(name='body'),
}

async function describeDispatchRuleWithOptions(request: DescribeDispatchRuleRequest, runtime: Util.RuntimeOptions): DescribeDispatchRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDispatchRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeDispatchRule(request: DescribeDispatchRuleRequest): DescribeDispatchRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDispatchRuleWithOptions(request, runtime);
}

model DescribePrometheusAlertRuleRequest {
  alertId?: long(name='AlertId'),
}

model DescribePrometheusAlertRuleResponseBody = {
  prometheusAlertRule?: {
    alertId?: long(name='AlertId'),
    alertName?: string(name='AlertName'),
    annotations?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Annotations'),
    clusterId?: string(name='ClusterId'),
    dispatchRuleId?: long(name='DispatchRuleId'),
    duration?: string(name='Duration'),
    expression?: string(name='Expression'),
    labels?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Labels'),
    message?: string(name='Message'),
    notifyType?: string(name='NotifyType'),
    status?: int32(name='Status'),
    type?: string(name='Type'),
  }(name='PrometheusAlertRule'),
  requestId?: string(name='RequestId'),
}

model DescribePrometheusAlertRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribePrometheusAlertRuleResponseBody(name='body'),
}

async function describePrometheusAlertRuleWithOptions(request: DescribePrometheusAlertRuleRequest, runtime: Util.RuntimeOptions): DescribePrometheusAlertRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribePrometheusAlertRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describePrometheusAlertRule(request: DescribePrometheusAlertRuleRequest): DescribePrometheusAlertRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePrometheusAlertRuleWithOptions(request, runtime);
}

model DescribeTraceLicenseKeyRequest {
  regionId?: string(name='RegionId'),
}

model DescribeTraceLicenseKeyResponseBody = {
  licenseKey?: string(name='LicenseKey'),
  requestId?: string(name='RequestId'),
}

model DescribeTraceLicenseKeyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeTraceLicenseKeyResponseBody(name='body'),
}

async function describeTraceLicenseKeyWithOptions(request: DescribeTraceLicenseKeyRequest, runtime: Util.RuntimeOptions): DescribeTraceLicenseKeyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTraceLicenseKey',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeTraceLicenseKey(request: DescribeTraceLicenseKeyRequest): DescribeTraceLicenseKeyResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeTraceLicenseKeyWithOptions(request, runtime);
}

model DescribeTraceLocationRequest {
  regionId?: string(name='RegionId'),
}

model DescribeTraceLocationResponseBody = {
  regionConfigs?: [ 
    {
      regionNo?: string(name='RegionNo'),
      url?: string(name='Url'),
    }
  ](name='RegionConfigs'),
  requestId?: string(name='RequestId'),
}

model DescribeTraceLocationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeTraceLocationResponseBody(name='body'),
}

async function describeTraceLocationWithOptions(request: DescribeTraceLocationRequest, runtime: Util.RuntimeOptions): DescribeTraceLocationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTraceLocation',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeTraceLocation(request: DescribeTraceLocationRequest): DescribeTraceLocationResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeTraceLocationWithOptions(request, runtime);
}

model DisableAlertTemplateRequest {
  id?: long(name='Id'),
  regionId?: string(name='RegionId'),
}

model DisableAlertTemplateResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisableAlertTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisableAlertTemplateResponseBody(name='body'),
}

async function disableAlertTemplateWithOptions(request: DisableAlertTemplateRequest, runtime: Util.RuntimeOptions): DisableAlertTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableAlertTemplate',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disableAlertTemplate(request: DisableAlertTemplateRequest): DisableAlertTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableAlertTemplateWithOptions(request, runtime);
}

model EnableAlertTemplateRequest {
  id?: long(name='Id'),
  regionId?: string(name='RegionId'),
}

model EnableAlertTemplateResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model EnableAlertTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EnableAlertTemplateResponseBody(name='body'),
}

async function enableAlertTemplateWithOptions(request: EnableAlertTemplateRequest, runtime: Util.RuntimeOptions): EnableAlertTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableAlertTemplate',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function enableAlertTemplate(request: EnableAlertTemplateRequest): EnableAlertTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableAlertTemplateWithOptions(request, runtime);
}

model ExportPrometheusRulesRequest {
  clusterId?: string(name='ClusterId'),
  name?: string(name='Name'),
  nameSpace?: string(name='NameSpace'),
  regionId?: string(name='RegionId'),
}

model ExportPrometheusRulesResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model ExportPrometheusRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ExportPrometheusRulesResponseBody(name='body'),
}

async function exportPrometheusRulesWithOptions(request: ExportPrometheusRulesRequest, runtime: Util.RuntimeOptions): ExportPrometheusRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.nameSpace)) {
    query['NameSpace'] = request.nameSpace;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ExportPrometheusRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function exportPrometheusRules(request: ExportPrometheusRulesRequest): ExportPrometheusRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return exportPrometheusRulesWithOptions(request, runtime);
}

model GetAgentDownloadUrlRequest {
  regionId?: string(name='RegionId'),
}

model GetAgentDownloadUrlResponseBody = {
  armsAgentDownloadUrl?: string(name='ArmsAgentDownloadUrl'),
  requestId?: string(name='RequestId'),
}

model GetAgentDownloadUrlResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAgentDownloadUrlResponseBody(name='body'),
}

async function getAgentDownloadUrlWithOptions(request: GetAgentDownloadUrlRequest, runtime: Util.RuntimeOptions): GetAgentDownloadUrlResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAgentDownloadUrl',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAgentDownloadUrl(request: GetAgentDownloadUrlRequest): GetAgentDownloadUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAgentDownloadUrlWithOptions(request, runtime);
}

model GetAppApiByPageRequest {
  currentPage?: int32(name='CurrentPage'),
  endTime?: long(name='EndTime'),
  intervalMills?: int32(name='IntervalMills'),
  PId?: string(name='PId'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
  startTime?: long(name='StartTime'),
}

model GetAppApiByPageResponseBody = {
  code?: int32(name='Code'),
  data?: {
    items?: [  map[string]any ](name='Items'),
    page?: int32(name='Page'),
    pageSize?: int32(name='PageSize'),
    total?: string(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetAppApiByPageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAppApiByPageResponseBody(name='body'),
}

async function getAppApiByPageWithOptions(request: GetAppApiByPageRequest, runtime: Util.RuntimeOptions): GetAppApiByPageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.intervalMills)) {
    query['IntervalMills'] = request.intervalMills;
  }
  if (!Util.isUnset(request.PId)) {
    query['PId'] = request.PId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAppApiByPage',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAppApiByPage(request: GetAppApiByPageRequest): GetAppApiByPageResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAppApiByPageWithOptions(request, runtime);
}

model GetConsistencySnapshotRequest {
  appType?: string(name='AppType'),
  currentTimestamp?: long(name='CurrentTimestamp'),
  pid?: string(name='Pid'),
  proxyUserId?: string(name='ProxyUserId'),
  regionId?: string(name='RegionId'),
}

model GetConsistencySnapshotResponseBody = {
  consistencyResultJsonStr?: string(name='ConsistencyResultJsonStr'),
  requestId?: string(name='RequestId'),
}

model GetConsistencySnapshotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetConsistencySnapshotResponseBody(name='body'),
}

async function getConsistencySnapshotWithOptions(request: GetConsistencySnapshotRequest, runtime: Util.RuntimeOptions): GetConsistencySnapshotResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appType)) {
    query['AppType'] = request.appType;
  }
  if (!Util.isUnset(request.currentTimestamp)) {
    query['CurrentTimestamp'] = request.currentTimestamp;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConsistencySnapshot',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getConsistencySnapshot(request: GetConsistencySnapshotRequest): GetConsistencySnapshotResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConsistencySnapshotWithOptions(request, runtime);
}

model GetIntegrationTokenRequest {
  productType?: string(name='ProductType'),
  regionId?: string(name='RegionId'),
}

model GetIntegrationTokenResponseBody = {
  requestId?: string(name='RequestId'),
  token?: string(name='Token'),
}

model GetIntegrationTokenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetIntegrationTokenResponseBody(name='body'),
}

async function getIntegrationTokenWithOptions(request: GetIntegrationTokenRequest, runtime: Util.RuntimeOptions): GetIntegrationTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetIntegrationToken',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getIntegrationToken(request: GetIntegrationTokenRequest): GetIntegrationTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return getIntegrationTokenWithOptions(request, runtime);
}

model GetMultipleTraceRequest {
  regionId?: string(name='RegionId'),
  traceIDs?: [ string ](name='TraceIDs'),
}

model GetMultipleTraceResponseBody = {
  multiCallChainInfos?: [ 
    {
      spans?: [ 
        {
          duration?: long(name='Duration'),
          haveStack?: boolean(name='HaveStack'),
          logEventList?: [ 
            {
              tagEntryList?: [ 
                {
                  key?: string(name='Key'),
                  value?: string(name='Value'),
                }
              ](name='TagEntryList'),
              timestamp?: long(name='Timestamp'),
            }
          ](name='LogEventList'),
          operationName?: string(name='OperationName'),
          parentSpanId?: string(name='ParentSpanId'),
          resultCode?: string(name='ResultCode'),
          rpcId?: string(name='RpcId'),
          rpcType?: int32(name='RpcType'),
          serviceIp?: string(name='ServiceIp'),
          serviceName?: string(name='ServiceName'),
          spanId?: string(name='SpanId'),
          tagEntryList?: [ 
            {
              key?: string(name='Key'),
              value?: string(name='Value'),
            }
          ](name='TagEntryList'),
          timestamp?: long(name='Timestamp'),
          traceID?: string(name='TraceID'),
        }
      ](name='Spans'),
      traceID?: string(name='TraceID'),
    }
  ](name='MultiCallChainInfos'),
  requestId?: string(name='RequestId'),
}

model GetMultipleTraceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetMultipleTraceResponseBody(name='body'),
}

async function getMultipleTraceWithOptions(request: GetMultipleTraceRequest, runtime: Util.RuntimeOptions): GetMultipleTraceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.traceIDs)) {
    query['TraceIDs'] = request.traceIDs;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetMultipleTrace',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getMultipleTrace(request: GetMultipleTraceRequest): GetMultipleTraceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMultipleTraceWithOptions(request, runtime);
}

model GetPrometheusApiTokenRequest {
  regionId?: string(name='RegionId'),
}

model GetPrometheusApiTokenResponseBody = {
  requestId?: string(name='RequestId'),
  token?: string(name='Token'),
}

model GetPrometheusApiTokenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPrometheusApiTokenResponseBody(name='body'),
}

async function getPrometheusApiTokenWithOptions(request: GetPrometheusApiTokenRequest, runtime: Util.RuntimeOptions): GetPrometheusApiTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPrometheusApiToken',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPrometheusApiToken(request: GetPrometheusApiTokenRequest): GetPrometheusApiTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPrometheusApiTokenWithOptions(request, runtime);
}

model GetRetcodeShareUrlRequest {
  pid?: string(name='Pid'),
}

model GetRetcodeShareUrlResponseBody = {
  requestId?: string(name='RequestId'),
  url?: string(name='Url'),
}

model GetRetcodeShareUrlResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetRetcodeShareUrlResponseBody(name='body'),
}

async function getRetcodeShareUrlWithOptions(request: GetRetcodeShareUrlRequest, runtime: Util.RuntimeOptions): GetRetcodeShareUrlResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRetcodeShareUrl',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRetcodeShareUrl(request: GetRetcodeShareUrlRequest): GetRetcodeShareUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRetcodeShareUrlWithOptions(request, runtime);
}

model GetStackRequest {
  pid?: string(name='Pid'),
  regionId?: string(name='RegionId'),
  rpcID?: string(name='RpcID'),
  traceID?: string(name='TraceID'),
}

model GetStackResponseBody = {
  requestId?: string(name='RequestId'),
  stackInfo?: [ 
    {
      api?: string(name='Api'),
      duration?: long(name='Duration'),
      exception?: string(name='Exception'),
      extInfo?: {
        info?: string(name='Info'),
        type?: string(name='Type'),
      }(name='ExtInfo'),
      line?: string(name='Line'),
      rpcId?: string(name='RpcId'),
      serviceName?: string(name='ServiceName'),
      startTime?: long(name='StartTime'),
    }
  ](name='StackInfo'),
}

model GetStackResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetStackResponseBody(name='body'),
}

async function getStackWithOptions(request: GetStackRequest, runtime: Util.RuntimeOptions): GetStackResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.rpcID)) {
    query['RpcID'] = request.rpcID;
  }
  if (!Util.isUnset(request.traceID)) {
    query['TraceID'] = request.traceID;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetStack',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getStack(request: GetStackRequest): GetStackResponse {
  var runtime = new Util.RuntimeOptions{};
  return getStackWithOptions(request, runtime);
}

model GetTraceRequest {
  regionId?: string(name='RegionId'),
  traceID?: string(name='TraceID'),
}

model GetTraceResponseBody = {
  requestId?: string(name='RequestId'),
  spans?: [ 
    {
      duration?: long(name='Duration'),
      haveStack?: boolean(name='HaveStack'),
      logEventList?: [ 
        {
          tagEntryList?: [ 
            {
              key?: string(name='Key'),
              value?: string(name='Value'),
            }
          ](name='TagEntryList'),
          timestamp?: long(name='Timestamp'),
        }
      ](name='LogEventList'),
      operationName?: string(name='OperationName'),
      parentSpanId?: string(name='ParentSpanId'),
      resultCode?: string(name='ResultCode'),
      rpcId?: string(name='RpcId'),
      rpcType?: int32(name='RpcType'),
      serviceIp?: string(name='ServiceIp'),
      serviceName?: string(name='ServiceName'),
      spanId?: string(name='SpanId'),
      tagEntryList?: [ 
        {
          key?: string(name='Key'),
          value?: string(name='Value'),
        }
      ](name='TagEntryList'),
      timestamp?: long(name='Timestamp'),
      traceID?: string(name='TraceID'),
    }
  ](name='Spans'),
}

model GetTraceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTraceResponseBody(name='body'),
}

async function getTraceWithOptions(request: GetTraceRequest, runtime: Util.RuntimeOptions): GetTraceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.traceID)) {
    query['TraceID'] = request.traceID;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTrace',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTrace(request: GetTraceRequest): GetTraceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTraceWithOptions(request, runtime);
}

model GetTraceAppRequest {
  pid?: string(name='Pid'),
  regionId?: string(name='RegionId'),
}

model GetTraceAppResponseBody = {
  requestId?: string(name='RequestId'),
  traceApp?: {
    appId?: long(name='AppId'),
    appName?: string(name='AppName'),
    createTime?: long(name='CreateTime'),
    labels?: [ string ](name='Labels'),
    pid?: string(name='Pid'),
    regionId?: string(name='RegionId'),
    show?: boolean(name='Show'),
    type?: string(name='Type'),
    updateTime?: long(name='UpdateTime'),
    userId?: string(name='UserId'),
  }(name='TraceApp'),
}

model GetTraceAppResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTraceAppResponseBody(name='body'),
}

async function getTraceAppWithOptions(request: GetTraceAppRequest, runtime: Util.RuntimeOptions): GetTraceAppResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTraceApp',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTraceApp(request: GetTraceAppRequest): GetTraceAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTraceAppWithOptions(request, runtime);
}

model ImportAppAlertRulesRequest {
  contactGroupIds?: string(name='ContactGroupIds'),
  isAutoStart?: boolean(name='IsAutoStart'),
  pids?: string(name='Pids'),
  regionId?: string(name='RegionId'),
  templageAlertConfig?: string(name='TemplageAlertConfig'),
  templateAlertId?: string(name='TemplateAlertId'),
}

model ImportAppAlertRulesResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model ImportAppAlertRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ImportAppAlertRulesResponseBody(name='body'),
}

async function importAppAlertRulesWithOptions(request: ImportAppAlertRulesRequest, runtime: Util.RuntimeOptions): ImportAppAlertRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactGroupIds)) {
    query['ContactGroupIds'] = request.contactGroupIds;
  }
  if (!Util.isUnset(request.isAutoStart)) {
    query['IsAutoStart'] = request.isAutoStart;
  }
  if (!Util.isUnset(request.pids)) {
    query['Pids'] = request.pids;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.templageAlertConfig)) {
    query['TemplageAlertConfig'] = request.templageAlertConfig;
  }
  if (!Util.isUnset(request.templateAlertId)) {
    query['TemplateAlertId'] = request.templateAlertId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ImportAppAlertRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function importAppAlertRules(request: ImportAppAlertRulesRequest): ImportAppAlertRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return importAppAlertRulesWithOptions(request, runtime);
}

model ImportCustomAlertRulesRequest {
  contactGroupIds?: string(name='ContactGroupIds'),
  isAutoStart?: boolean(name='IsAutoStart'),
  regionId?: string(name='RegionId'),
  templageAlertConfig?: string(name='TemplageAlertConfig'),
  templateAlertConfig?: string(name='TemplateAlertConfig'),
}

model ImportCustomAlertRulesResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model ImportCustomAlertRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ImportCustomAlertRulesResponseBody(name='body'),
}

async function importCustomAlertRulesWithOptions(request: ImportCustomAlertRulesRequest, runtime: Util.RuntimeOptions): ImportCustomAlertRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactGroupIds)) {
    query['ContactGroupIds'] = request.contactGroupIds;
  }
  if (!Util.isUnset(request.isAutoStart)) {
    query['IsAutoStart'] = request.isAutoStart;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.templageAlertConfig)) {
    query['TemplageAlertConfig'] = request.templageAlertConfig;
  }
  if (!Util.isUnset(request.templateAlertConfig)) {
    query['TemplateAlertConfig'] = request.templateAlertConfig;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ImportCustomAlertRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function importCustomAlertRules(request: ImportCustomAlertRulesRequest): ImportCustomAlertRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return importCustomAlertRulesWithOptions(request, runtime);
}

model ImportPrometheusRulesRequest {
  clusterId?: string(name='ClusterId'),
  content?: string(name='Content'),
  name?: string(name='Name'),
  nameSpace?: string(name='NameSpace'),
  regionId?: string(name='RegionId'),
}

model ImportPrometheusRulesResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model ImportPrometheusRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ImportPrometheusRulesResponseBody(name='body'),
}

async function importPrometheusRulesWithOptions(request: ImportPrometheusRulesRequest, runtime: Util.RuntimeOptions): ImportPrometheusRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.nameSpace)) {
    query['NameSpace'] = request.nameSpace;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ImportPrometheusRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function importPrometheusRules(request: ImportPrometheusRulesRequest): ImportPrometheusRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return importPrometheusRulesWithOptions(request, runtime);
}

model ListActivatedAlertsRequest {
  currentPage?: int32(name='CurrentPage'),
  filter?: string(name='Filter'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
}

model ListActivatedAlertsResponseBody = {
  page?: {
    alerts?: [ 
      {
        alertId?: string(name='AlertId'),
        alertName?: string(name='AlertName'),
        alertType?: string(name='AlertType'),
        count?: int32(name='Count'),
        createTime?: long(name='CreateTime'),
        dispatchRules?: [ 
          {
            ruleId?: int32(name='RuleId'),
            ruleName?: string(name='RuleName'),
          }
        ](name='DispatchRules'),
        endsAt?: long(name='EndsAt'),
        expandFields?: map[string]any(name='ExpandFields'),
        integrationName?: string(name='IntegrationName'),
        integrationType?: string(name='IntegrationType'),
        involvedObjectKind?: string(name='InvolvedObjectKind'),
        involvedObjectName?: string(name='InvolvedObjectName'),
        message?: string(name='Message'),
        severity?: string(name='Severity'),
        startsAt?: long(name='StartsAt'),
        status?: string(name='Status'),
      }
    ](name='Alerts'),
    page?: int32(name='Page'),
    pageSize?: int32(name='PageSize'),
    total?: int32(name='Total'),
  }(name='Page'),
  requestId?: string(name='RequestId'),
}

model ListActivatedAlertsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListActivatedAlertsResponseBody(name='body'),
}

async function listActivatedAlertsWithOptions(request: ListActivatedAlertsRequest, runtime: Util.RuntimeOptions): ListActivatedAlertsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.filter)) {
    query['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListActivatedAlerts',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listActivatedAlerts(request: ListActivatedAlertsRequest): ListActivatedAlertsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listActivatedAlertsWithOptions(request, runtime);
}

model ListAlertTemplatesRequest {
  alertProvider?: string(name='AlertProvider'),
  labels?: string(name='Labels'),
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  status?: boolean(name='Status'),
  templateProvider?: string(name='TemplateProvider'),
  type?: string(name='Type'),
}

model ListAlertTemplatesResponseBody = {
  alertTemplates?: [ 
    {
      alertProvider?: string(name='AlertProvider'),
      annotations?: map[string]any(name='Annotations'),
      id?: int32(name='Id'),
      labelMatchExpressionGrid?: {
        labelMatchExpressionGroups?: [ 
          {
            labelMatchExpressions?: [ 
              {
                key?: string(name='Key'),
                operator?: string(name='Operator'),
                value?: string(name='Value'),
              }
            ](name='LabelMatchExpressions'),
          }
        ](name='LabelMatchExpressionGroups'),
      }(name='LabelMatchExpressionGrid'),
      labels?: map[string]any(name='Labels'),
      message?: string(name='Message'),
      name?: string(name='Name'),
      parentId?: int32(name='ParentId'),
      public?: boolean(name='Public'),
      rule?: string(name='Rule'),
      status?: boolean(name='Status'),
      templateProvider?: string(name='TemplateProvider'),
      type?: string(name='Type'),
      userId?: string(name='UserId'),
    }
  ](name='AlertTemplates'),
  requestId?: string(name='RequestId'),
}

model ListAlertTemplatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAlertTemplatesResponseBody(name='body'),
}

async function listAlertTemplatesWithOptions(request: ListAlertTemplatesRequest, runtime: Util.RuntimeOptions): ListAlertTemplatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertProvider)) {
    query['AlertProvider'] = request.alertProvider;
  }
  if (!Util.isUnset(request.labels)) {
    query['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.templateProvider)) {
    query['TemplateProvider'] = request.templateProvider;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAlertTemplates',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAlertTemplates(request: ListAlertTemplatesRequest): ListAlertTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAlertTemplatesWithOptions(request, runtime);
}

model ListClusterFromGrafanaRequest {
  regionId?: string(name='RegionId'),
}

model ListClusterFromGrafanaResponseBody = {
  promClusterList?: [ 
    {
      agentStatus?: string(name='AgentStatus'),
      clusterId?: string(name='ClusterId'),
      clusterName?: string(name='ClusterName'),
      clusterType?: string(name='ClusterType'),
      controllerId?: string(name='ControllerId'),
      createTime?: long(name='CreateTime'),
      extra?: string(name='Extra'),
      id?: long(name='Id'),
      installTime?: long(name='InstallTime'),
      isControllerInstalled?: boolean(name='IsControllerInstalled'),
      lastHeartBeatTime?: long(name='LastHeartBeatTime'),
      nodeNum?: int32(name='NodeNum'),
      options?: string(name='Options'),
      pluginsJsonArray?: string(name='PluginsJsonArray'),
      regionId?: string(name='RegionId'),
      stateJson?: string(name='StateJson'),
      updateTime?: long(name='UpdateTime'),
      userId?: string(name='UserId'),
    }
  ](name='PromClusterList'),
  requestId?: string(name='RequestId'),
}

model ListClusterFromGrafanaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListClusterFromGrafanaResponseBody(name='body'),
}

async function listClusterFromGrafanaWithOptions(request: ListClusterFromGrafanaRequest, runtime: Util.RuntimeOptions): ListClusterFromGrafanaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListClusterFromGrafana',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listClusterFromGrafana(request: ListClusterFromGrafanaRequest): ListClusterFromGrafanaResponse {
  var runtime = new Util.RuntimeOptions{};
  return listClusterFromGrafanaWithOptions(request, runtime);
}

model ListDashboardsRequest {
  clusterId?: string(name='ClusterId'),
  clusterType?: string(name='ClusterType'),
  product?: string(name='Product'),
  recreateSwitch?: boolean(name='RecreateSwitch'),
  regionId?: string(name='RegionId'),
  title?: string(name='Title'),
}

model ListDashboardsResponseBody = {
  dashboardVos?: [ 
    {
      dashboardType?: string(name='DashboardType'),
      exporter?: string(name='Exporter'),
      id?: string(name='Id'),
      isArmsExporter?: boolean(name='IsArmsExporter'),
      kind?: string(name='Kind'),
      name?: string(name='Name'),
      needUpdate?: boolean(name='NeedUpdate'),
      tags?: [ string ](name='Tags'),
      time?: string(name='Time'),
      title?: string(name='Title'),
      type?: string(name='Type'),
      uid?: string(name='Uid'),
      url?: string(name='Url'),
      version?: string(name='Version'),
    }
  ](name='DashboardVos'),
  requestId?: string(name='RequestId'),
}

model ListDashboardsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardsResponseBody(name='body'),
}

async function listDashboardsWithOptions(request: ListDashboardsRequest, runtime: Util.RuntimeOptions): ListDashboardsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.clusterType)) {
    query['ClusterType'] = request.clusterType;
  }
  if (!Util.isUnset(request.product)) {
    query['Product'] = request.product;
  }
  if (!Util.isUnset(request.recreateSwitch)) {
    query['RecreateSwitch'] = request.recreateSwitch;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.title)) {
    query['Title'] = request.title;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboards',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDashboards(request: ListDashboardsRequest): ListDashboardsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDashboardsWithOptions(request, runtime);
}

model ListDispatchRuleRequest {
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  system?: boolean(name='System'),
}

model ListDispatchRuleResponseBody = {
  dispatchRules?: [ 
    {
      name?: string(name='Name'),
      ruleId?: long(name='RuleId'),
      state?: string(name='State'),
    }
  ](name='DispatchRules'),
  requestId?: string(name='RequestId'),
}

model ListDispatchRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDispatchRuleResponseBody(name='body'),
}

async function listDispatchRuleWithOptions(request: ListDispatchRuleRequest, runtime: Util.RuntimeOptions): ListDispatchRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.system)) {
    query['System'] = request.system;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDispatchRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDispatchRule(request: ListDispatchRuleRequest): ListDispatchRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDispatchRuleWithOptions(request, runtime);
}

model ListPromClustersRequest {
  regionId?: string(name='RegionId'),
}

model ListPromClustersResponseBody = {
  promClusterList?: [ 
    {
      agentStatus?: string(name='AgentStatus'),
      clusterId?: string(name='ClusterId'),
      clusterName?: string(name='ClusterName'),
      clusterType?: string(name='ClusterType'),
      controllerId?: string(name='ControllerId'),
      createTime?: long(name='CreateTime'),
      extra?: string(name='Extra'),
      id?: long(name='Id'),
      installTime?: long(name='InstallTime'),
      isControllerInstalled?: boolean(name='IsControllerInstalled'),
      lastHeartBeatTime?: long(name='LastHeartBeatTime'),
      nodeNum?: int32(name='NodeNum'),
      options?: string(name='Options'),
      pluginsJsonArray?: string(name='PluginsJsonArray'),
      regionId?: string(name='RegionId'),
      stateJson?: string(name='StateJson'),
      updateTime?: long(name='UpdateTime'),
      userId?: string(name='UserId'),
    }
  ](name='PromClusterList'),
  requestId?: string(name='RequestId'),
}

model ListPromClustersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPromClustersResponseBody(name='body'),
}

async function listPromClustersWithOptions(request: ListPromClustersRequest, runtime: Util.RuntimeOptions): ListPromClustersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPromClusters',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPromClusters(request: ListPromClustersRequest): ListPromClustersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPromClustersWithOptions(request, runtime);
}

model ListPrometheusAlertRulesRequest {
  clusterId?: string(name='ClusterId'),
  matchExpressions?: string(name='MatchExpressions'),
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  status?: int32(name='Status'),
  type?: string(name='Type'),
}

model ListPrometheusAlertRulesResponseBody = {
  prometheusAlertRules?: [ 
    {
      alertId?: long(name='AlertId'),
      alertName?: string(name='AlertName'),
      annotations?: [ 
        {
          name?: string(name='Name'),
          value?: string(name='Value'),
        }
      ](name='Annotations'),
      clusterId?: string(name='ClusterId'),
      dispatchRuleId?: long(name='DispatchRuleId'),
      duration?: string(name='Duration'),
      expression?: string(name='Expression'),
      labels?: [ 
        {
          name?: string(name='Name'),
          value?: string(name='Value'),
        }
      ](name='Labels'),
      message?: string(name='Message'),
      notifyType?: string(name='NotifyType'),
      status?: int32(name='Status'),
      type?: string(name='Type'),
    }
  ](name='PrometheusAlertRules'),
  requestId?: string(name='RequestId'),
}

model ListPrometheusAlertRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPrometheusAlertRulesResponseBody(name='body'),
}

async function listPrometheusAlertRulesWithOptions(request: ListPrometheusAlertRulesRequest, runtime: Util.RuntimeOptions): ListPrometheusAlertRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.matchExpressions)) {
    query['MatchExpressions'] = request.matchExpressions;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPrometheusAlertRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPrometheusAlertRules(request: ListPrometheusAlertRulesRequest): ListPrometheusAlertRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPrometheusAlertRulesWithOptions(request, runtime);
}

model ListPrometheusAlertTemplatesRequest {
  clusterId?: string(name='ClusterId'),
  regionId?: string(name='RegionId'),
}

model ListPrometheusAlertTemplatesResponseBody = {
  prometheusAlertTemplates?: [ 
    {
      alertName?: string(name='AlertName'),
      annotations?: [ 
        {
          name?: string(name='Name'),
          value?: string(name='Value'),
        }
      ](name='Annotations'),
      description?: string(name='Description'),
      duration?: string(name='Duration'),
      expression?: string(name='Expression'),
      labels?: [ 
        {
          name?: string(name='Name'),
          value?: string(name='Value'),
        }
      ](name='Labels'),
      type?: string(name='Type'),
      version?: string(name='Version'),
    }
  ](name='PrometheusAlertTemplates'),
  requestId?: string(name='RequestId'),
}

model ListPrometheusAlertTemplatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPrometheusAlertTemplatesResponseBody(name='body'),
}

async function listPrometheusAlertTemplatesWithOptions(request: ListPrometheusAlertTemplatesRequest, runtime: Util.RuntimeOptions): ListPrometheusAlertTemplatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPrometheusAlertTemplates',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPrometheusAlertTemplates(request: ListPrometheusAlertTemplatesRequest): ListPrometheusAlertTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPrometheusAlertTemplatesWithOptions(request, runtime);
}

model ListRetcodeAppsRequest {
  regionId?: string(name='RegionId'),
  securityToken?: string(name='SecurityToken'),
}

model ListRetcodeAppsResponseBody = {
  requestId?: string(name='RequestId'),
  retcodeApps?: [ 
    {
      appId?: long(name='AppId'),
      appName?: string(name='AppName'),
      pid?: string(name='Pid'),
    }
  ](name='RetcodeApps'),
}

model ListRetcodeAppsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRetcodeAppsResponseBody(name='body'),
}

async function listRetcodeAppsWithOptions(request: ListRetcodeAppsRequest, runtime: Util.RuntimeOptions): ListRetcodeAppsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRetcodeApps',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRetcodeApps(request: ListRetcodeAppsRequest): ListRetcodeAppsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRetcodeAppsWithOptions(request, runtime);
}

model ListScenarioRequest {
  appId?: string(name='AppId'),
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  scenario?: string(name='Scenario'),
  sign?: string(name='Sign'),
}

model ListScenarioResponseBody = {
  armsScenarios?: [ 
    {
      appId?: string(name='AppId'),
      createTime?: string(name='CreateTime'),
      extensions?: string(name='Extensions'),
      id?: long(name='Id'),
      name?: string(name='Name'),
      regionId?: string(name='RegionId'),
      sign?: string(name='Sign'),
      updateTime?: string(name='UpdateTime'),
      userId?: string(name='UserId'),
    }
  ](name='ArmsScenarios'),
  requestId?: string(name='RequestId'),
}

model ListScenarioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListScenarioResponseBody(name='body'),
}

async function listScenarioWithOptions(request: ListScenarioRequest, runtime: Util.RuntimeOptions): ListScenarioResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.scenario)) {
    query['Scenario'] = request.scenario;
  }
  if (!Util.isUnset(request.sign)) {
    query['Sign'] = request.sign;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListScenario',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listScenario(request: ListScenarioRequest): ListScenarioResponse {
  var runtime = new Util.RuntimeOptions{};
  return listScenarioWithOptions(request, runtime);
}

model ListServerlessTopNAppsRequest {
  endTime?: long(name='EndTime'),
  limit?: int32(name='Limit'),
  orderBy?: string(name='OrderBy'),
  regionId?: string(name='RegionId'),
  startTime?: long(name='StartTime'),
}

model ListServerlessTopNAppsResponseBody = {
  data?: [ 
    {
      count?: int32(name='Count'),
      error?: int32(name='Error'),
      name?: string(name='Name'),
      pid?: string(name='Pid'),
      region?: string(name='Region'),
      rt?: float(name='Rt'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
}

model ListServerlessTopNAppsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListServerlessTopNAppsResponseBody(name='body'),
}

async function listServerlessTopNAppsWithOptions(request: ListServerlessTopNAppsRequest, runtime: Util.RuntimeOptions): ListServerlessTopNAppsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListServerlessTopNApps',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listServerlessTopNApps(request: ListServerlessTopNAppsRequest): ListServerlessTopNAppsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listServerlessTopNAppsWithOptions(request, runtime);
}

model ListTraceAppsRequest {
  regionId?: string(name='RegionId'),
}

model ListTraceAppsResponseBody = {
  code?: int32(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  traceApps?: [ 
    {
      appId?: long(name='AppId'),
      appName?: string(name='AppName'),
      createTime?: long(name='CreateTime'),
      labels?: [ string ](name='Labels'),
      pid?: string(name='Pid'),
      regionId?: string(name='RegionId'),
      show?: boolean(name='Show'),
      type?: string(name='Type'),
      updateTime?: long(name='UpdateTime'),
      userId?: string(name='UserId'),
    }
  ](name='TraceApps'),
}

model ListTraceAppsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTraceAppsResponseBody(name='body'),
}

async function listTraceAppsWithOptions(request: ListTraceAppsRequest, runtime: Util.RuntimeOptions): ListTraceAppsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTraceApps',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTraceApps(request: ListTraceAppsRequest): ListTraceAppsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTraceAppsWithOptions(request, runtime);
}

model OpenArmsDefaultSLRRequest {
  regionId?: string(name='RegionId'),
}

model OpenArmsDefaultSLRResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model OpenArmsDefaultSLRResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: OpenArmsDefaultSLRResponseBody(name='body'),
}

async function openArmsDefaultSLRWithOptions(request: OpenArmsDefaultSLRRequest, runtime: Util.RuntimeOptions): OpenArmsDefaultSLRResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'OpenArmsDefaultSLR',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function openArmsDefaultSLR(request: OpenArmsDefaultSLRRequest): OpenArmsDefaultSLRResponse {
  var runtime = new Util.RuntimeOptions{};
  return openArmsDefaultSLRWithOptions(request, runtime);
}

model OpenArmsServiceRequest {
  ownerId?: long(name='OwnerId'),
  type?: string(name='Type'),
}

model OpenArmsServiceResponseBody = {
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId'),
}

model OpenArmsServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: OpenArmsServiceResponseBody(name='body'),
}

async function openArmsServiceWithOptions(request: OpenArmsServiceRequest, runtime: Util.RuntimeOptions): OpenArmsServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'OpenArmsService',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function openArmsService(request: OpenArmsServiceRequest): OpenArmsServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return openArmsServiceWithOptions(request, runtime);
}

model OpenVClusterRequest {
  clusterType?: string(name='ClusterType'),
  length?: int32(name='Length'),
  product?: string(name='Product'),
  recreateSwitch?: boolean(name='RecreateSwitch'),
  regionId?: string(name='RegionId'),
}

model OpenVClusterResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model OpenVClusterResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: OpenVClusterResponseBody(name='body'),
}

async function openVClusterWithOptions(request: OpenVClusterRequest, runtime: Util.RuntimeOptions): OpenVClusterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clusterType)) {
    query['ClusterType'] = request.clusterType;
  }
  if (!Util.isUnset(request.length)) {
    query['Length'] = request.length;
  }
  if (!Util.isUnset(request.product)) {
    query['Product'] = request.product;
  }
  if (!Util.isUnset(request.recreateSwitch)) {
    query['RecreateSwitch'] = request.recreateSwitch;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'OpenVCluster',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function openVCluster(request: OpenVClusterRequest): OpenVClusterResponse {
  var runtime = new Util.RuntimeOptions{};
  return openVClusterWithOptions(request, runtime);
}

model OpenXtraceDefaultSLRRequest {
  regionId?: string(name='RegionId'),
}

model OpenXtraceDefaultSLRResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model OpenXtraceDefaultSLRResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: OpenXtraceDefaultSLRResponseBody(name='body'),
}

async function openXtraceDefaultSLRWithOptions(request: OpenXtraceDefaultSLRRequest, runtime: Util.RuntimeOptions): OpenXtraceDefaultSLRResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'OpenXtraceDefaultSLR',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function openXtraceDefaultSLR(request: OpenXtraceDefaultSLRRequest): OpenXtraceDefaultSLRResponse {
  var runtime = new Util.RuntimeOptions{};
  return openXtraceDefaultSLRWithOptions(request, runtime);
}

model QueryDatasetRequest {
  datasetId?: long(name='DatasetId'),
  dateStr?: string(name='DateStr'),
  dimensions?: [ 
    {
      key?: string(name='Key'),
      type?: string(name='Type'),
      value?: string(name='Value'),
    }
  ](name='Dimensions'),
  hungryMode?: boolean(name='HungryMode'),
  intervalInSec?: int32(name='IntervalInSec'),
  isDrillDown?: boolean(name='IsDrillDown'),
  limit?: int32(name='Limit'),
  maxTime?: long(name='MaxTime'),
  measures?: [ string ](name='Measures'),
  minTime?: long(name='MinTime'),
  optionalDims?: [ 
    {
      key?: string(name='Key'),
      type?: string(name='Type'),
      value?: string(name='Value'),
    }
  ](name='OptionalDims'),
  orderByKey?: string(name='OrderByKey'),
  proxyUserId?: string(name='ProxyUserId'),
  reduceTail?: boolean(name='ReduceTail'),
  requiredDims?: [ 
    {
      key?: string(name='Key'),
      type?: string(name='Type'),
      value?: string(name='Value'),
    }
  ](name='RequiredDims'),
}

model QueryDatasetResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model QueryDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryDatasetResponseBody(name='body'),
}

async function queryDatasetWithOptions(request: QueryDatasetRequest, runtime: Util.RuntimeOptions): QueryDatasetResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.datasetId)) {
    query['DatasetId'] = request.datasetId;
  }
  if (!Util.isUnset(request.dateStr)) {
    query['DateStr'] = request.dateStr;
  }
  if (!Util.isUnset(request.dimensions)) {
    query['Dimensions'] = request.dimensions;
  }
  if (!Util.isUnset(request.hungryMode)) {
    query['HungryMode'] = request.hungryMode;
  }
  if (!Util.isUnset(request.intervalInSec)) {
    query['IntervalInSec'] = request.intervalInSec;
  }
  if (!Util.isUnset(request.isDrillDown)) {
    query['IsDrillDown'] = request.isDrillDown;
  }
  if (!Util.isUnset(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!Util.isUnset(request.maxTime)) {
    query['MaxTime'] = request.maxTime;
  }
  if (!Util.isUnset(request.measures)) {
    query['Measures'] = request.measures;
  }
  if (!Util.isUnset(request.minTime)) {
    query['MinTime'] = request.minTime;
  }
  if (!Util.isUnset(request.optionalDims)) {
    query['OptionalDims'] = request.optionalDims;
  }
  if (!Util.isUnset(request.orderByKey)) {
    query['OrderByKey'] = request.orderByKey;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.reduceTail)) {
    query['ReduceTail'] = request.reduceTail;
  }
  if (!Util.isUnset(request.requiredDims)) {
    query['RequiredDims'] = request.requiredDims;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDataset',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryDataset(request: QueryDatasetRequest): QueryDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryDatasetWithOptions(request, runtime);
}

model QueryMetricRequest {
  consistencyDataKey?: string(name='ConsistencyDataKey'),
  consistencyQueryStrategy?: string(name='ConsistencyQueryStrategy'),
  dimensions?: [ string ](name='Dimensions'),
  endTime?: long(name='EndTime'),
  filters?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Filters'),
  intervalInSec?: int32(name='IntervalInSec'),
  limit?: int32(name='Limit'),
  measures?: [ string ](name='Measures'),
  metric?: string(name='Metric'),
  order?: string(name='Order'),
  orderBy?: string(name='OrderBy'),
  proxyUserId?: string(name='ProxyUserId'),
  startTime?: long(name='StartTime'),
}

model QueryMetricResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model QueryMetricResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryMetricResponseBody(name='body'),
}

async function queryMetricWithOptions(request: QueryMetricRequest, runtime: Util.RuntimeOptions): QueryMetricResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.consistencyDataKey)) {
    query['ConsistencyDataKey'] = request.consistencyDataKey;
  }
  if (!Util.isUnset(request.consistencyQueryStrategy)) {
    query['ConsistencyQueryStrategy'] = request.consistencyQueryStrategy;
  }
  if (!Util.isUnset(request.dimensions)) {
    query['Dimensions'] = request.dimensions;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.intervalInSec)) {
    query['IntervalInSec'] = request.intervalInSec;
  }
  if (!Util.isUnset(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!Util.isUnset(request.measures)) {
    query['Measures'] = request.measures;
  }
  if (!Util.isUnset(request.metric)) {
    query['Metric'] = request.metric;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.proxyUserId)) {
    query['ProxyUserId'] = request.proxyUserId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryMetric',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryMetric(request: QueryMetricRequest): QueryMetricResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryMetricWithOptions(request, runtime);
}

model QueryMetricByPageRequest {
  currentPage?: int32(name='CurrentPage'),
  customFilters?: [ string ](name='CustomFilters'),
  dimensions?: [ string ](name='Dimensions'),
  endTime?: long(name='EndTime'),
  filters?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Filters'),
  intervalInSec?: int32(name='IntervalInSec'),
  measures?: [ string ](name='Measures'),
  metric?: string(name='Metric'),
  order?: string(name='Order'),
  orderBy?: string(name='OrderBy'),
  pageSize?: int32(name='PageSize'),
  startTime?: long(name='StartTime'),
}

model QueryMetricByPageResponseBody = {
  code?: string(name='Code'),
  data?: {
    items?: [  map[string]any ](name='Items'),
    page?: int32(name='Page'),
    pageSize?: int32(name='PageSize'),
    total?: int32(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryMetricByPageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryMetricByPageResponseBody(name='body'),
}

async function queryMetricByPageWithOptions(request: QueryMetricByPageRequest, runtime: Util.RuntimeOptions): QueryMetricByPageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.customFilters)) {
    query['CustomFilters'] = request.customFilters;
  }
  if (!Util.isUnset(request.dimensions)) {
    query['Dimensions'] = request.dimensions;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.intervalInSec)) {
    query['IntervalInSec'] = request.intervalInSec;
  }
  if (!Util.isUnset(request.measures)) {
    query['Measures'] = request.measures;
  }
  if (!Util.isUnset(request.metric)) {
    query['Metric'] = request.metric;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryMetricByPage',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryMetricByPage(request: QueryMetricByPageRequest): QueryMetricByPageResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryMetricByPageWithOptions(request, runtime);
}

model SaveTraceAppConfigRequest {
  pid?: string(name='Pid'),
  settings?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Settings'),
}

model SaveTraceAppConfigResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model SaveTraceAppConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveTraceAppConfigResponseBody(name='body'),
}

async function saveTraceAppConfigWithOptions(request: SaveTraceAppConfigRequest, runtime: Util.RuntimeOptions): SaveTraceAppConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.settings)) {
    query['Settings'] = request.settings;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveTraceAppConfig',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveTraceAppConfig(request: SaveTraceAppConfigRequest): SaveTraceAppConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveTraceAppConfigWithOptions(request, runtime);
}

model SearchAlertContactRequest {
  contactIds?: string(name='ContactIds'),
  contactName?: string(name='ContactName'),
  currentPage?: string(name='CurrentPage'),
  email?: string(name='Email'),
  pageSize?: string(name='PageSize'),
  phone?: string(name='Phone'),
  regionId?: string(name='RegionId'),
}

model SearchAlertContactResponseBody = {
  pageBean?: {
    contacts?: [ 
      {
        contactId?: long(name='ContactId'),
        contactName?: string(name='ContactName'),
        createTime?: long(name='CreateTime'),
        dingRobot?: string(name='DingRobot'),
        email?: string(name='Email'),
        phone?: string(name='Phone'),
        systemNoc?: boolean(name='SystemNoc'),
        updateTime?: long(name='UpdateTime'),
        userId?: string(name='UserId'),
        webhook?: string(name='Webhook'),
      }
    ](name='Contacts'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchAlertContactResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchAlertContactResponseBody(name='body'),
}

async function searchAlertContactWithOptions(request: SearchAlertContactRequest, runtime: Util.RuntimeOptions): SearchAlertContactResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactIds)) {
    query['ContactIds'] = request.contactIds;
  }
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phone)) {
    query['Phone'] = request.phone;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchAlertContact',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchAlertContact(request: SearchAlertContactRequest): SearchAlertContactResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchAlertContactWithOptions(request, runtime);
}

model SearchAlertContactGroupRequest {
  contactGroupIds?: string(name='ContactGroupIds'),
  contactGroupName?: string(name='ContactGroupName'),
  contactId?: long(name='ContactId'),
  contactName?: string(name='ContactName'),
  isDetail?: boolean(name='IsDetail'),
  regionId?: string(name='RegionId'),
}

model SearchAlertContactGroupResponseBody = {
  contactGroups?: [ 
    {
      contactGroupId?: long(name='ContactGroupId'),
      contactGroupName?: string(name='ContactGroupName'),
      contacts?: [ 
        {
          contactId?: long(name='ContactId'),
          contactName?: string(name='ContactName'),
          createTime?: long(name='CreateTime'),
          dingRobot?: string(name='DingRobot'),
          email?: string(name='Email'),
          phone?: string(name='Phone'),
          systemNoc?: boolean(name='SystemNoc'),
          updateTime?: long(name='UpdateTime'),
          userId?: string(name='UserId'),
        }
      ](name='Contacts'),
      createTime?: long(name='CreateTime'),
      updateTime?: long(name='UpdateTime'),
      userId?: string(name='UserId'),
    }
  ](name='ContactGroups'),
  requestId?: string(name='RequestId'),
}

model SearchAlertContactGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchAlertContactGroupResponseBody(name='body'),
}

async function searchAlertContactGroupWithOptions(request: SearchAlertContactGroupRequest, runtime: Util.RuntimeOptions): SearchAlertContactGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactGroupIds)) {
    query['ContactGroupIds'] = request.contactGroupIds;
  }
  if (!Util.isUnset(request.contactGroupName)) {
    query['ContactGroupName'] = request.contactGroupName;
  }
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.isDetail)) {
    query['IsDetail'] = request.isDetail;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchAlertContactGroup',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchAlertContactGroup(request: SearchAlertContactGroupRequest): SearchAlertContactGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchAlertContactGroupWithOptions(request, runtime);
}

model SearchAlertHistoriesRequest {
  alertId?: long(name='AlertId'),
  alertType?: int32(name='AlertType'),
  currentPage?: int32(name='CurrentPage'),
  endTime?: long(name='EndTime'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
  startTime?: long(name='StartTime'),
}

model SearchAlertHistoriesResponseBody = {
  pageBean?: {
    alarmHistories?: [ 
      {
        alarmContent?: string(name='AlarmContent'),
        alarmResponseCode?: int32(name='AlarmResponseCode'),
        alarmSources?: string(name='AlarmSources'),
        alarmTime?: long(name='AlarmTime'),
        alarmType?: int32(name='AlarmType'),
        emails?: string(name='Emails'),
        id?: long(name='Id'),
        phones?: string(name='Phones'),
        strategyId?: string(name='StrategyId'),
        target?: string(name='Target'),
        userId?: string(name='UserId'),
      }
    ](name='AlarmHistories'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchAlertHistoriesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchAlertHistoriesResponseBody(name='body'),
}

async function searchAlertHistoriesWithOptions(request: SearchAlertHistoriesRequest, runtime: Util.RuntimeOptions): SearchAlertHistoriesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  if (!Util.isUnset(request.alertType)) {
    query['AlertType'] = request.alertType;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchAlertHistories',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchAlertHistories(request: SearchAlertHistoriesRequest): SearchAlertHistoriesResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchAlertHistoriesWithOptions(request, runtime);
}

model SearchAlertRulesRequest {
  appType?: string(name='AppType'),
  currentPage?: int32(name='CurrentPage'),
  pageSize?: int32(name='PageSize'),
  pid?: string(name='Pid'),
  regionId?: string(name='RegionId'),
  title?: string(name='Title'),
  type?: string(name='Type'),
}

model SearchAlertRulesResponseBody = {
  pageBean?: {
    alertRules?: [ 
      {
        alarmContext?: {
          alarmContentSubTitle?: string(name='AlarmContentSubTitle'),
          alarmContentTemplate?: string(name='AlarmContentTemplate'),
          content?: string(name='Content'),
          subTitle?: string(name='SubTitle'),
        }(name='AlarmContext'),
        alertLevel?: string(name='AlertLevel'),
        alertRule?: {
          operator?: string(name='Operator'),
          rules?: [ 
            {
              aggregates?: string(name='Aggregates'),
              alias?: string(name='Alias'),
              measure?: string(name='Measure'),
              NValue?: int32(name='NValue'),
              operator?: string(name='Operator'),
              value?: float(name='Value'),
            }
          ](name='Rules'),
        }(name='AlertRule'),
        alertTitle?: string(name='AlertTitle'),
        alertType?: int32(name='AlertType'),
        alertVersion?: int32(name='AlertVersion'),
        alertWay?: [ string ](name='AlertWay'),
        alertWays?: [ string ](name='AlertWays'),
        config?: string(name='Config'),
        contactGroupIdList?: string(name='ContactGroupIdList'),
        contactGroupIds?: string(name='ContactGroupIds'),
        createTime?: long(name='CreateTime'),
        id?: long(name='Id'),
        metricParam?: {
          appGroupId?: string(name='AppGroupId'),
          appId?: string(name='AppId'),
          dimensions?: [ 
            {
              key?: string(name='Key'),
              type?: string(name='Type'),
              value?: string(name='Value'),
            }
          ](name='Dimensions'),
          pid?: string(name='Pid'),
          type?: string(name='Type'),
        }(name='MetricParam'),
        notice?: {
          endTime?: long(name='EndTime'),
          noticeEndTime?: long(name='NoticeEndTime'),
          noticeStartTime?: long(name='NoticeStartTime'),
          startTime?: long(name='StartTime'),
        }(name='Notice'),
        regionId?: string(name='RegionId'),
        status?: string(name='Status'),
        taskId?: long(name='TaskId'),
        taskStatus?: string(name='TaskStatus'),
        title?: string(name='Title'),
        updateTime?: long(name='UpdateTime'),
        userId?: string(name='UserId'),
      }
    ](name='AlertRules'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchAlertRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchAlertRulesResponseBody(name='body'),
}

async function searchAlertRulesWithOptions(request: SearchAlertRulesRequest, runtime: Util.RuntimeOptions): SearchAlertRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appType)) {
    query['AppType'] = request.appType;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.title)) {
    query['Title'] = request.title;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchAlertRules',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchAlertRules(request: SearchAlertRulesRequest): SearchAlertRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchAlertRulesWithOptions(request, runtime);
}

model SearchEventsRequest {
  alertId?: long(name='AlertId'),
  alertType?: int32(name='AlertType'),
  appType?: string(name='AppType'),
  currentPage?: int32(name='CurrentPage'),
  endTime?: long(name='EndTime'),
  isTrigger?: int32(name='IsTrigger'),
  pageSize?: int32(name='PageSize'),
  pid?: string(name='Pid'),
  regionId?: string(name='RegionId'),
  startTime?: long(name='StartTime'),
}

model SearchEventsResponseBody = {
  isTrigger?: int32(name='IsTrigger'),
  pageBean?: {
    event?: [ 
      {
        alertId?: long(name='AlertId'),
        alertName?: string(name='AlertName'),
        alertRule?: string(name='AlertRule'),
        alertType?: int32(name='AlertType'),
        eventLevel?: string(name='EventLevel'),
        eventTime?: long(name='EventTime'),
        id?: long(name='Id'),
        links?: [ string ](name='Links'),
        message?: string(name='Message'),
      }
    ](name='Event'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchEventsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchEventsResponseBody(name='body'),
}

async function searchEventsWithOptions(request: SearchEventsRequest, runtime: Util.RuntimeOptions): SearchEventsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  if (!Util.isUnset(request.alertType)) {
    query['AlertType'] = request.alertType;
  }
  if (!Util.isUnset(request.appType)) {
    query['AppType'] = request.appType;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.isTrigger)) {
    query['IsTrigger'] = request.isTrigger;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchEvents',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchEvents(request: SearchEventsRequest): SearchEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchEventsWithOptions(request, runtime);
}

model SearchRetcodeAppByPageRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
  retcodeAppName?: string(name='RetcodeAppName'),
}

model SearchRetcodeAppByPageResponseBody = {
  pageBean?: {
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    retcodeApps?: [ 
      {
        appId?: long(name='AppId'),
        appName?: string(name='AppName'),
        createTime?: long(name='CreateTime'),
        pid?: string(name='Pid'),
        regionId?: string(name='RegionId'),
        type?: string(name='Type'),
        updateTime?: long(name='UpdateTime'),
        userId?: string(name='UserId'),
      }
    ](name='RetcodeApps'),
    totalCount?: int32(name='TotalCount'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchRetcodeAppByPageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchRetcodeAppByPageResponseBody(name='body'),
}

async function searchRetcodeAppByPageWithOptions(request: SearchRetcodeAppByPageRequest, runtime: Util.RuntimeOptions): SearchRetcodeAppByPageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.retcodeAppName)) {
    query['RetcodeAppName'] = request.retcodeAppName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchRetcodeAppByPage',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchRetcodeAppByPage(request: SearchRetcodeAppByPageRequest): SearchRetcodeAppByPageResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchRetcodeAppByPageWithOptions(request, runtime);
}

model SearchTraceAppByNameRequest {
  regionId?: string(name='RegionId'),
  traceAppName?: string(name='TraceAppName'),
}

model SearchTraceAppByNameResponseBody = {
  requestId?: string(name='RequestId'),
  traceApps?: [ 
    {
      appId?: long(name='AppId'),
      appName?: string(name='AppName'),
      createTime?: long(name='CreateTime'),
      labels?: [ string ](name='Labels'),
      pid?: string(name='Pid'),
      regionId?: string(name='RegionId'),
      show?: boolean(name='Show'),
      type?: string(name='Type'),
      updateTime?: long(name='UpdateTime'),
      userId?: string(name='UserId'),
    }
  ](name='TraceApps'),
}

model SearchTraceAppByNameResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTraceAppByNameResponseBody(name='body'),
}

async function searchTraceAppByNameWithOptions(request: SearchTraceAppByNameRequest, runtime: Util.RuntimeOptions): SearchTraceAppByNameResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.traceAppName)) {
    query['TraceAppName'] = request.traceAppName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTraceAppByName',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTraceAppByName(request: SearchTraceAppByNameRequest): SearchTraceAppByNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTraceAppByNameWithOptions(request, runtime);
}

model SearchTraceAppByPageRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
  traceAppName?: string(name='TraceAppName'),
}

model SearchTraceAppByPageResponseBody = {
  pageBean?: {
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
    traceApps?: [ 
      {
        appId?: long(name='AppId'),
        appName?: string(name='AppName'),
        createTime?: long(name='CreateTime'),
        labels?: [ string ](name='Labels'),
        pid?: string(name='Pid'),
        regionId?: string(name='RegionId'),
        show?: boolean(name='Show'),
        type?: string(name='Type'),
        updateTime?: long(name='UpdateTime'),
        userId?: string(name='UserId'),
      }
    ](name='TraceApps'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchTraceAppByPageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTraceAppByPageResponseBody(name='body'),
}

async function searchTraceAppByPageWithOptions(request: SearchTraceAppByPageRequest, runtime: Util.RuntimeOptions): SearchTraceAppByPageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.traceAppName)) {
    query['TraceAppName'] = request.traceAppName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTraceAppByPage',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTraceAppByPage(request: SearchTraceAppByPageRequest): SearchTraceAppByPageResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTraceAppByPageWithOptions(request, runtime);
}

model SearchTracesRequest {
  endTime?: long(name='EndTime'),
  exclusionFilters?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='ExclusionFilters'),
  minDuration?: long(name='MinDuration'),
  operationName?: string(name='OperationName'),
  regionId?: string(name='RegionId'),
  reverse?: boolean(name='Reverse'),
  serviceIp?: string(name='ServiceIp'),
  serviceName?: string(name='ServiceName'),
  startTime?: long(name='StartTime'),
  tag?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tag'),
}

model SearchTracesResponseBody = {
  requestId?: string(name='RequestId'),
  traceInfos?: [ 
    {
      duration?: long(name='Duration'),
      operationName?: string(name='OperationName'),
      serviceIp?: string(name='ServiceIp'),
      serviceName?: string(name='ServiceName'),
      timestamp?: long(name='Timestamp'),
      traceID?: string(name='TraceID'),
    }
  ](name='TraceInfos'),
}

model SearchTracesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTracesResponseBody(name='body'),
}

async function searchTracesWithOptions(request: SearchTracesRequest, runtime: Util.RuntimeOptions): SearchTracesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.exclusionFilters)) {
    query['ExclusionFilters'] = request.exclusionFilters;
  }
  if (!Util.isUnset(request.minDuration)) {
    query['MinDuration'] = request.minDuration;
  }
  if (!Util.isUnset(request.operationName)) {
    query['OperationName'] = request.operationName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.reverse)) {
    query['Reverse'] = request.reverse;
  }
  if (!Util.isUnset(request.serviceIp)) {
    query['ServiceIp'] = request.serviceIp;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTraces',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTraces(request: SearchTracesRequest): SearchTracesResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTracesWithOptions(request, runtime);
}

model SearchTracesByPageRequest {
  endTime?: long(name='EndTime'),
  exclusionFilters?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='ExclusionFilters'),
  minDuration?: long(name='MinDuration'),
  operationName?: string(name='OperationName'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
  reverse?: boolean(name='Reverse'),
  serviceIp?: string(name='ServiceIp'),
  serviceName?: string(name='ServiceName'),
  startTime?: long(name='StartTime'),
}

model SearchTracesByPageResponseBody = {
  pageBean?: {
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    total?: int32(name='Total'),
    traceInfos?: [ 
      {
        duration?: long(name='Duration'),
        operationName?: string(name='OperationName'),
        serviceIp?: string(name='ServiceIp'),
        serviceName?: string(name='ServiceName'),
        timestamp?: long(name='Timestamp'),
        traceID?: string(name='TraceID'),
      }
    ](name='TraceInfos'),
  }(name='PageBean'),
  requestId?: string(name='RequestId'),
}

model SearchTracesByPageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTracesByPageResponseBody(name='body'),
}

async function searchTracesByPageWithOptions(request: SearchTracesByPageRequest, runtime: Util.RuntimeOptions): SearchTracesByPageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.exclusionFilters)) {
    query['ExclusionFilters'] = request.exclusionFilters;
  }
  if (!Util.isUnset(request.minDuration)) {
    query['MinDuration'] = request.minDuration;
  }
  if (!Util.isUnset(request.operationName)) {
    query['OperationName'] = request.operationName;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.reverse)) {
    query['Reverse'] = request.reverse;
  }
  if (!Util.isUnset(request.serviceIp)) {
    query['ServiceIp'] = request.serviceIp;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTracesByPage',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTracesByPage(request: SearchTracesByPageRequest): SearchTracesByPageResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTracesByPageWithOptions(request, runtime);
}

model SendCustomIncidentsRequest {
  incidents?: string(name='Incidents'),
  productType?: string(name='ProductType'),
  regionId?: string(name='RegionId'),
}

model SendCustomIncidentsResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendCustomIncidentsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendCustomIncidentsResponseBody(name='body'),
}

async function sendCustomIncidentsWithOptions(request: SendCustomIncidentsRequest, runtime: Util.RuntimeOptions): SendCustomIncidentsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.incidents)) {
    query['Incidents'] = request.incidents;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SendCustomIncidents',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendCustomIncidents(request: SendCustomIncidentsRequest): SendCustomIncidentsResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendCustomIncidentsWithOptions(request, runtime);
}

model SendMseIncidentRequest {
  incidents?: string(name='Incidents'),
  regionId?: string(name='RegionId'),
}

model SendMseIncidentResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendMseIncidentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendMseIncidentResponseBody(name='body'),
}

async function sendMseIncidentWithOptions(request: SendMseIncidentRequest, runtime: Util.RuntimeOptions): SendMseIncidentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.incidents)) {
    query['Incidents'] = request.incidents;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SendMseIncident',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendMseIncident(request: SendMseIncidentRequest): SendMseIncidentResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendMseIncidentWithOptions(request, runtime);
}

model SetRetcodeShareStatusRequest {
  pid?: string(name='Pid'),
  status?: boolean(name='Status'),
}

model SetRetcodeShareStatusResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model SetRetcodeShareStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SetRetcodeShareStatusResponseBody(name='body'),
}

async function setRetcodeShareStatusWithOptions(request: SetRetcodeShareStatusRequest, runtime: Util.RuntimeOptions): SetRetcodeShareStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetRetcodeShareStatus',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function setRetcodeShareStatus(request: SetRetcodeShareStatusRequest): SetRetcodeShareStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return setRetcodeShareStatusWithOptions(request, runtime);
}

model StartAlertRequest {
  alertId?: string(name='AlertId'),
  regionId?: string(name='RegionId'),
}

model StartAlertResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model StartAlertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartAlertResponseBody(name='body'),
}

async function startAlertWithOptions(request: StartAlertRequest, runtime: Util.RuntimeOptions): StartAlertResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartAlert',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startAlert(request: StartAlertRequest): StartAlertResponse {
  var runtime = new Util.RuntimeOptions{};
  return startAlertWithOptions(request, runtime);
}

model StopAlertRequest {
  alertId?: string(name='AlertId'),
  regionId?: string(name='RegionId'),
}

model StopAlertResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model StopAlertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopAlertResponseBody(name='body'),
}

async function stopAlertWithOptions(request: StopAlertRequest, runtime: Util.RuntimeOptions): StopAlertResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopAlert',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopAlert(request: StopAlertRequest): StopAlertResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopAlertWithOptions(request, runtime);
}

model UpdateAlertContactRequest {
  contactId?: long(name='ContactId'),
  contactName?: string(name='ContactName'),
  dingRobotWebhookUrl?: string(name='DingRobotWebhookUrl'),
  email?: string(name='Email'),
  phoneNum?: string(name='PhoneNum'),
  regionId?: string(name='RegionId'),
  systemNoc?: boolean(name='SystemNoc'),
}

model UpdateAlertContactResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model UpdateAlertContactResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateAlertContactResponseBody(name='body'),
}

async function updateAlertContactWithOptions(request: UpdateAlertContactRequest, runtime: Util.RuntimeOptions): UpdateAlertContactResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.dingRobotWebhookUrl)) {
    query['DingRobotWebhookUrl'] = request.dingRobotWebhookUrl;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.phoneNum)) {
    query['PhoneNum'] = request.phoneNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.systemNoc)) {
    query['SystemNoc'] = request.systemNoc;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlertContact',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAlertContact(request: UpdateAlertContactRequest): UpdateAlertContactResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAlertContactWithOptions(request, runtime);
}

model UpdateAlertContactGroupRequest {
  contactGroupId?: long(name='ContactGroupId'),
  contactGroupName?: string(name='ContactGroupName'),
  contactIds?: string(name='ContactIds'),
  regionId?: string(name='RegionId'),
}

model UpdateAlertContactGroupResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model UpdateAlertContactGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateAlertContactGroupResponseBody(name='body'),
}

async function updateAlertContactGroupWithOptions(request: UpdateAlertContactGroupRequest, runtime: Util.RuntimeOptions): UpdateAlertContactGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactGroupId)) {
    query['ContactGroupId'] = request.contactGroupId;
  }
  if (!Util.isUnset(request.contactGroupName)) {
    query['ContactGroupName'] = request.contactGroupName;
  }
  if (!Util.isUnset(request.contactIds)) {
    query['ContactIds'] = request.contactIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlertContactGroup',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAlertContactGroup(request: UpdateAlertContactGroupRequest): UpdateAlertContactGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAlertContactGroupWithOptions(request, runtime);
}

model UpdateAlertRuleRequest {
  alertId?: long(name='AlertId'),
  contactGroupIds?: string(name='ContactGroupIds'),
  isAutoStart?: boolean(name='IsAutoStart'),
  regionId?: string(name='RegionId'),
  templageAlertConfig?: string(name='TemplageAlertConfig'),
}

model UpdateAlertRuleResponseBody = {
  alertId?: long(name='AlertId'),
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model UpdateAlertRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateAlertRuleResponseBody(name='body'),
}

async function updateAlertRuleWithOptions(request: UpdateAlertRuleRequest, runtime: Util.RuntimeOptions): UpdateAlertRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  if (!Util.isUnset(request.contactGroupIds)) {
    query['ContactGroupIds'] = request.contactGroupIds;
  }
  if (!Util.isUnset(request.isAutoStart)) {
    query['IsAutoStart'] = request.isAutoStart;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.templageAlertConfig)) {
    query['TemplageAlertConfig'] = request.templageAlertConfig;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlertRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAlertRule(request: UpdateAlertRuleRequest): UpdateAlertRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAlertRuleWithOptions(request, runtime);
}

model UpdateAlertTemplateRequest {
  annotations?: string(name='Annotations'),
  id?: long(name='Id'),
  labels?: string(name='Labels'),
  matchExpressions?: string(name='MatchExpressions'),
  message?: string(name='Message'),
  name?: string(name='Name'),
  regionId?: string(name='RegionId'),
  rule?: string(name='Rule'),
  status?: boolean(name='Status'),
  type?: string(name='Type'),
}

model UpdateAlertTemplateResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateAlertTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateAlertTemplateResponseBody(name='body'),
}

async function updateAlertTemplateWithOptions(request: UpdateAlertTemplateRequest, runtime: Util.RuntimeOptions): UpdateAlertTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.annotations)) {
    query['Annotations'] = request.annotations;
  }
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.labels)) {
    query['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.matchExpressions)) {
    query['MatchExpressions'] = request.matchExpressions;
  }
  if (!Util.isUnset(request.message)) {
    query['Message'] = request.message;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.rule)) {
    query['Rule'] = request.rule;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlertTemplate',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAlertTemplate(request: UpdateAlertTemplateRequest): UpdateAlertTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAlertTemplateWithOptions(request, runtime);
}

model UpdateDispatchRuleRequest {
  dispatchRule?: string(name='DispatchRule'),
  regionId?: string(name='RegionId'),
}

model UpdateDispatchRuleResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateDispatchRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateDispatchRuleResponseBody(name='body'),
}

async function updateDispatchRuleWithOptions(request: UpdateDispatchRuleRequest, runtime: Util.RuntimeOptions): UpdateDispatchRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dispatchRule)) {
    query['DispatchRule'] = request.dispatchRule;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDispatchRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateDispatchRule(request: UpdateDispatchRuleRequest): UpdateDispatchRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateDispatchRuleWithOptions(request, runtime);
}

model UpdatePrometheusAlertRuleRequest {
  alertId?: long(name='AlertId'),
  alertName?: string(name='AlertName'),
  annotations?: string(name='Annotations'),
  clusterId?: string(name='ClusterId'),
  dispatchRuleId?: long(name='DispatchRuleId'),
  duration?: string(name='Duration'),
  expression?: string(name='Expression'),
  labels?: string(name='Labels'),
  message?: string(name='Message'),
  notifyType?: string(name='NotifyType'),
  regionId?: string(name='RegionId'),
  type?: string(name='Type'),
}

model UpdatePrometheusAlertRuleResponseBody = {
  prometheusAlertRule?: {
    alertId?: long(name='AlertId'),
    alertName?: string(name='AlertName'),
    annotations?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Annotations'),
    clusterId?: string(name='ClusterId'),
    dispatchRuleId?: long(name='DispatchRuleId'),
    duration?: string(name='Duration'),
    expression?: string(name='Expression'),
    labels?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Labels'),
    message?: string(name='Message'),
    notifyType?: string(name='NotifyType'),
    status?: int32(name='Status'),
    type?: string(name='Type'),
  }(name='PrometheusAlertRule'),
  requestId?: string(name='RequestId'),
}

model UpdatePrometheusAlertRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdatePrometheusAlertRuleResponseBody(name='body'),
}

async function updatePrometheusAlertRuleWithOptions(request: UpdatePrometheusAlertRuleRequest, runtime: Util.RuntimeOptions): UpdatePrometheusAlertRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.alertId)) {
    query['AlertId'] = request.alertId;
  }
  if (!Util.isUnset(request.alertName)) {
    query['AlertName'] = request.alertName;
  }
  if (!Util.isUnset(request.annotations)) {
    query['Annotations'] = request.annotations;
  }
  if (!Util.isUnset(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!Util.isUnset(request.dispatchRuleId)) {
    query['DispatchRuleId'] = request.dispatchRuleId;
  }
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.expression)) {
    query['Expression'] = request.expression;
  }
  if (!Util.isUnset(request.labels)) {
    query['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.message)) {
    query['Message'] = request.message;
  }
  if (!Util.isUnset(request.notifyType)) {
    query['NotifyType'] = request.notifyType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdatePrometheusAlertRule',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updatePrometheusAlertRule(request: UpdatePrometheusAlertRuleRequest): UpdatePrometheusAlertRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updatePrometheusAlertRuleWithOptions(request, runtime);
}

model UpdateWebhookRequest {
  body?: string(name='Body'),
  contactId?: long(name='ContactId'),
  contactName?: string(name='ContactName'),
  httpHeaders?: string(name='HttpHeaders'),
  httpParams?: string(name='HttpParams'),
  method?: string(name='Method'),
  regionId?: string(name='RegionId'),
  url?: string(name='Url'),
}

model UpdateWebhookResponseBody = {
  isSuccess?: boolean(name='IsSuccess'),
  requestId?: string(name='RequestId'),
}

model UpdateWebhookResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateWebhookResponseBody(name='body'),
}

async function updateWebhookWithOptions(request: UpdateWebhookRequest, runtime: Util.RuntimeOptions): UpdateWebhookResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.body)) {
    query['Body'] = request.body;
  }
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.contactName)) {
    query['ContactName'] = request.contactName;
  }
  if (!Util.isUnset(request.httpHeaders)) {
    query['HttpHeaders'] = request.httpHeaders;
  }
  if (!Util.isUnset(request.httpParams)) {
    query['HttpParams'] = request.httpParams;
  }
  if (!Util.isUnset(request.method)) {
    query['Method'] = request.method;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.url)) {
    query['Url'] = request.url;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateWebhook',
    version = '2021-04-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateWebhook(request: UpdateWebhookRequest): UpdateWebhookResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateWebhookWithOptions(request, runtime);
}

